from pygame.sprite import Sprite, Group
import pygame






class Buttons:
# create button for player
    # create group for sprite - need this to draw the sprites
    group = Group()
    position_x = 0
    
    def __init__(self, starting_position, buttons ):
        self.position_x = starting_position
        
        for i in buttons:        
            button1 = Button1(i,( self.position_x,0))
            self.position_x += button1.image.get_width()
            self.group.add(button1)
            
    def get_width( self ):
        return self.position_x
        
    def draw(self, screen):
        self.group.draw(screen)


class Button1(Sprite):
    def __init__(self,picture, position):
        #call Sprite initializer
        pygame.sprite.Sprite.__init__(self)
        # loading button image
        self.image = pygame.image.load('images/' + picture + '_button.png').convert()

        # declare sprite size same as image
        self.rect = self.image.get_rect()
        self.rect = self.rect.move(position)

        